# Maintainer: Andrew Wheeler <genusistimelord@gmail.com>

_realname=libswift
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.0.0
pkgrel=2
pkgdesc="a library that attempts to satisfy the most fundamental needs of
C programmers by providing Data structures, Networking, IO, Threading, and so
forth. libswift was originally created by S.J.R. van Schaik and is currently
being managed by Andrew Wheeler"
arch=('any')
url="https://ascendingcreations.com"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=(${MINGW_PACKAGE_PREFIX}-gcc-libs
         ${MINGW_PACKAGE_PREFIX}-bzip2
         ${MINGW_PACKAGE_PREFIX}-libiconv
         ${MINGW_PACKAGE_PREFIX}-libpng
         ${MINGW_PACKAGE_PREFIX}-freetype
         ${MINGW_PACKAGE_PREFIX}-glfw
         ${MINGW_PACKAGE_PREFIX}-zlib)
options=('!libtool' 'strip')
source=("https://ascendingcreations.com/packages/${_realname}-${pkgver}.tar.gz")
sha256sums=('611ffd5dfb8f98a85752cc7f87a2cb469f5ff11663f067b31c579ad3f9b010c9')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  sh autogen.sh
}

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --enable-shared \
    --enable-static

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
